#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int leap_year(int y) {
	if (y % 4 == 0 && y % 100 != 0 || y % 400 == 0)
		return 1;
	else
		return 0;
}

int main() {
	printf("year:");
	int y;
	while (scanf("%d", &y) == 1 && y > 0) {
		int a = 1;
		for (int i = 1; i < y ; i++) {
			leap_year(i) ? (a = (a + 366) % 7) : (a = (a + 365) % 7);

		}
		printf("New Year's Day:");
		switch (a) {
		case 0:
			printf("Sun");
			break;
		case 1:
			printf("Mon");
			break;
		case 2:
			printf("Tue");
			break;
		case 3:
			printf("Wed");
			break;
		case 4:
			printf("Thu");
			break;
		case 5:
			printf("Fri");
			break;
		case 6:
			printf("Sat");
			break;
		}
		printf("\nyear:");
	}
	printf("Bye!");
	return 0;
}